﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace DemoCore.Routings
{
    internal class RoutingFilter
    {
        public string Address { get; set; }

        public string Filter { get; set; }

        public string Endpoint { get; set; }

        private Regex regex;

        private Regex Regex
        {
            get
            {
                if (regex == null)
                    regex = new Regex(this.Filter, RegexOptions.IgnoreCase);
                return regex;
            }
        }

        public bool IsMatch(string filterData)
        {
            return this.Regex.IsMatch(filterData);
        }
    }
}
